package com.studyweb.controller;

import com.studyweb.pojo.entity.UserPoints;
import com.studyweb.pojo.vo.Result;
import com.studyweb.service.UserPointsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.ResponseEntity;

/**
 * 用户积分控制器
 */
@Slf4j
@RestController
@RequestMapping("/api/user/points")
public class UserPointsController {

    @Autowired
    private UserPointsService userPointsService;

    /**
     * 获取用户积分信息
     *
     * @param userId 用户ID
     * @return 用户积分信息
     */
    @GetMapping("/{userId}")
    public Result<UserPoints> getUserPoints(@PathVariable Long userId) {
        log.info("获取用户积分信息: {}", userId);
        UserPoints userPoints = userPointsService.getUserPoints(userId);
        return Result.success("获取积分信息成功", userPoints);
    }
}